package com.tencent.sr.iris.activity.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author linaXie
 * @date 2021/12/31
 */
@AllArgsConstructor
@Getter
public enum StaffFromTypeEnum {
    IN("0", "内部销售"),
    OUTER_NON_SIGN("1", "外部未签约"),
    OUTER_SIGN("2", "外部已签约"),
    IN_STAFF("3", "内部员工"),
    PLATFORM_STAFF("4", "平台员工"),
    TUTOR("5", "团长导师");

    private String code;
    private String desc;

    /**
     * 判断是否为外部账号。目前有外部未签约、外部已签约
     */
    public static boolean isOuterSign(String code) {
        if (StaffFromTypeEnum.OUTER_NON_SIGN.getCode().equals(code)
                || StaffFromTypeEnum.OUTER_SIGN.getCode().equals(code)) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * 是否为内部账号。目前有内部销售、平台员工、团长导师、内部员工
     */
    public static Boolean isInnerSign(String type) {
        return StaffFromTypeEnum.getByCode(type) == null
                || StaffFromTypeEnum.IN.getCode().equals(type)
                || StaffFromTypeEnum.IN_STAFF.getCode().equals(type)
                || StaffFromTypeEnum.TUTOR.getCode().equals(type)
                || StaffFromTypeEnum.PLATFORM_STAFF.getCode().equals(type);
    }

    public static StaffFromTypeEnum getByCode(String code) {
        for (StaffFromTypeEnum staff : StaffFromTypeEnum.values()) {
            if (staff.getCode().equals(code)) {
                return staff;
            }
        }
        return null;
    }

    /**
     * 判断是否为内部员工权限。目前平台员工、团长导师、内部员工权限一致
     */
    public static boolean isInnerAuthority(String type) {
        if (StaffFromTypeEnum.IN_STAFF.getCode().equals(type)
                || StaffFromTypeEnum.TUTOR.getCode().equals(type)
                || StaffFromTypeEnum.PLATFORM_STAFF.getCode().equals(type)) {
            return true;
        } else {
            return false;
        }
    }
}
